
package com.example.tianya_android_test;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * @author 
 * @className MainActivity
 * @date Nov 26, 2013 4:01:38 PM
 * @version 1.0
 * @Description 绠＄悊鍏朵粬activity
 */ 

// test!
//here are my changes
public class MainActivity extends Activity {

    private ListView mListView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initListener();
    }	

    
    @SuppressWarnings("unchecked")
    private void initView() {

        mListView = (ListView) findViewById(R.id.lv_main);
        mListView.setAdapter(new ArrayAdapter(this,
                android.R.layout.simple_expandable_list_item_1, getData()));
    }

    private List getData() {

        List data = new ArrayList();
        for (int i = 1; i < 24; i++) {
            data.add("瀹為獙  " + i);
        }
        return data;
    }

    /**
     * @Title: initListener
     * @param
     * @return void
     * @throws
     * @date Nov 26, 2013 4:55:36 PM
     * @version 1.0
     * @Description: 瀵筶ist鐩戝惉
     */
    private void initListener() {

        //鍚勪釜瀹為獙鐨凙ctivity
        final Class<?>[] qClasses = {};

        mListView.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {

                Intent qIntent = new Intent(MainActivity.this,
                        qClasses[position]);
                MainActivity.this.startActivity(qIntent);

            }

        });

    }
}
